// server.js
const express = require('express');

const bodyParser = require('body-parser');
const login = require('./api/login');
const app = express();
const port = 3000;
app.use(bodyParser.json());
// 允许跨域请求
app.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});

// 模拟登录接口
app.post('/api/login', login);

app.listen(port, () => {
  console.log(`Mock server is running at http://localhost:${port}`);
});
